<template>
   <div class="goods_mana_type-container">
    <breadcrumb style="position: absolute;width:100%;"></breadcrumb>
    <div class="content">
        
      <!-- <div class="query">
        <div class="margin_right_20">
          活动名称:&nbsp;
          <el-input v-model="value" placeholder="请输入内容" style="width:100px;height:30px;"></el-input>
        </div>
         <div class="margin_right_20">
          开奖方式:&nbsp;
         <el-select v-model="status3">
           <el-option label="全部" value="0"></el-option>
           <el-option label="按人数开奖" value="1"></el-option>
           <el-option label="按时间开奖" value="2"></el-option>
         </el-select>
        </div>
        <div class="margin_right_20">
          状态:&nbsp;
          <el-select v-model="value1" style="width: 100px;">
            <el-option label="全部" value="0"></el-option>
            <el-option label="已开奖" value="1"></el-option>
            <el-option label="待开奖" value="2"></el-option>
          </el-select>
        </div>
         <div class="margin_right_20">
          开始时间(开始):&nbsp;
          <el-input v-model="value" placeholder="请输入内容" style="width:100px;height:30px;"></el-input>
        </div>
         <div class="margin_right_20">
          开奖时间(结束):&nbsp;
          <el-input v-model="value" placeholder="请输入内容" style="width:100px;height:30px;"></el-input>
          
        </div>
        </div> -->
        <div class="btn" >
            <div class="box">
              <el-row class="row">
                <el-col :span="3">
                  <div class="grid-content bg-purple">抽奖商品</div>
                </el-col>

                <el-col :span="4">
                  <div class="grid-content bg-purple-light">
                    <el-upload
                      class="avatar-uploader"
                      :action="uploadURL"
                      list-type="picture-card"
                      :headers="headers"
                      :on-success="handleSuccess"
                      :on-remove="handleRemove"
                      :on-preview="handlePreview"
                      :before-upload="handleChange5" disabled
                    >
                      <img v-if="imageUrl1" :src="imageUrl1" class="avatar" />
                     
                      <!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i> -->
                    </el-upload> {{goodsims}}

                    <!-- @click="select_goods" -->
                    <el-button type="primary" @click=" $router.push('/selectGoods')">点击选择</el-button>
                  </div>
                </el-col>
                <!-- <el-col :span="3">
                  <div class="grid-content bg-purple">
                    <span>商品名称</span>
                  </div>
                </el-col> -->
              </el-row>
              <el-row class="row1">
                <el-col :span="1">
                  <div class="grid-content bg-purple">活动发起方</div>
                </el-col>
                <el-col :span="4">
                  <div class="grid-content bg-purple">
                    <el-input style="width:200px;" v-model="form.stuser"></el-input>
                  </div>
                </el-col>
                <el-col :span="1">
                  <div class="grid-content bg-purple">奖品数量</div>
                </el-col>
                <el-col :span="4">
                  <div class="grid-content bg-purple">
                    <el-input style="width:200px;" v-model="form.max"></el-input>
                  </div>
                </el-col>
              
              </el-row>
              <el-row class="row1">
                 <el-col :span="1">
                  <div class="grid-content bg-purple">
                    活动名称
                  </div>
                </el-col>
                <el-col :span="4">
                  <div class="grid-content bg-purple">
                   
                    <el-input v-model="form.name" style="width:200px;"></el-input>
                  </div>
                </el-col>
                <el-col :span="1">
                  <div class="grid-content bg-purple-light">活动开始时间</div>
                </el-col>
                <el-col :span="3">
                  <div class="grid-content bg-purple-light">
                    <div class="inline-block" style="width:100px;">
                      <span class="demonstration"></span>
                      <el-date-picker
                        v-model="form.value4"
                        type="datetime"
                        placeholder="选择日期"
                        format="yyyy-MM-dd HH:mm:ss"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        :picker-options="value4"
                      ></el-date-picker>
                    </div>
                  </div>
                </el-col>
              </el-row>
              <el-row class="row1">
                <el-col :span="1">
                  <div class="grid-content bg-purple-light">开奖方式</div>
                </el-col>
                <el-col :span="4">
                  <div class="grid-content bg-purple">
                    <el-select placeholder v-model="form.status" style="width:200px;">
                      <el-option label="按人数开奖" value="2"></el-option>
                      <el-option label="按时间开奖" value="1"></el-option>
                     
                    </el-select>
                  </div>
                </el-col>
                <el-col :span="1">
                  <div class="grid-content bg-purple-light">开奖结束时间</div>
                </el-col>
                <el-col :span="3">
                  <div class="grid-content bg-purple-light">
                    <div class="block">
                      <span class="demonstration"></span>
                      <el-date-picker
                        v-model="form.value3"
                        type="datetime"
                        placeholder="选择日期时间"
                        format="yyyy-MM-dd HH:00:00"
                        value-format="yyyy-MM-dd HH:00:00"
                        @change="updateDate"
                        :picker-options="value3"
                      ></el-date-picker>
                    </div>
                  </div>
                </el-col>
              </el-row>
              <el-row class="row1" v-if="this.form.status==2?true:false">
                  <el-col :span="1">
                  <div class="grid-content bg-purple">
                    人数设置
                    
                  </div>
                </el-col>
                <el-col :span="4">
                  <div class="grid-content bg-purple">
                    
                    <el-input v-model="form.name4" style="width:200px;" placeholder="请输入参与人数"></el-input>
                  </div>
                </el-col>
                <el-col :span="3">
                  <div class="grid-content bg-purple-light"></div>
                </el-col>
                <!-- <el-col :span="8">
                  <div class="grid-content bg-purple-light">
                    <el-input v-model="form.name3" style="width:100px;"></el-input>
                  </div>
                </el-col> -->
              </el-row>
              <el-row class="row1">
                  <el-col :span="1">
                  <div class="grid-content bg-purple">
                    是否指定中奖人
                    
                  </div>
                </el-col>
                <el-col :span="4">
                  <div class="grid-content bg-purple">
                    
                    <el-select v-model="form.Appoint" style="width:200px;">
                      <el-option label="不配置" value="1"></el-option>

                      <el-option label="指定中奖用户" value="0"></el-option>
                    </el-select>
                  </div>
                </el-col>
                <!-- <el-col :span="3">
                  <div class="grid-content bg-purple-light">中奖人选择</div>
                </el-col>-->
                  <el-col :span="1" v-if="form.Appoint==1?false:true">
                  <div class="grid-content bg-purple">
                    中奖人选择
                    
                  </div>
                </el-col>
                <el-col :span="1" v-if="form.Appoint==1?false:true">
                  <div class="grid-content bg-purple-light">
                   <el-button type="primary" style="width:70px;" @click=" getlist()">选择</el-button>
                    
                    <!-- <el-input  style="width:100px;" placeholder="请选定中奖人"></el-input> -->
                     <!-- <span v-for="item in this.userlist" :key="item.id"> <el-button type="text" @click="getr(item.id)">id:{{item.id}}&nbsp;用户名:&nbsp;{{item.name}}&nbsp;删除</el-button> </span> -->
                   
                  </div>
                </el-col>
                 <el-col :span="1" v-if="form.Appoint==1?false:true">
                  <div class="grid-content bg-purple">
                    <!-- {{this.form.iduser}} -->
                <!-- {{form.iduser}} -->
                  </div>
                </el-col>
                <el-col :span="1">
                  <div class="grid-content bg-purple">

                  </div>
                </el-col>
              </el-row>
              <el-row class="row1" v-if="this.form.iduser?true:false">
                <el-col :span="6">
                  <div class="grid-content bg-purple" >
                    <!-- <template slot-scope="scope">
                      <span>{{scope.row.form.iduser}}</span>
                    </template> -->
                    <!-- <span style="width:30px;">{{this.form.iduser[0]}}</span> -->
                    <!-- <span style="width:30px;">{{this.form.iduser[1]}}</span>
                    <span style="width:30px;">{{this.form.iduser[2]}}</span>
                    <span>{{this.form.iduser[3]}}</span> -->
                    <!-- <span v-for="item in form.iduser" :key="item"> <el-button type="text" @click="getr(item)">{{item}}删除</el-button> </span> -->
                     <span v-for="item in this.userlist" :key="item.id"> <el-button type="text" @click="getr(item.id)">id:{{item.id}}&nbsp;用户名:&nbsp;{{item.name}}&nbsp;删除</el-button> </span>
                  </div>
                </el-col>
              </el-row>
              <el-row class="row1">
                   <el-col :span="1">
                  <div class="grid-content bg-purple">
                    指定性别
                    
                  </div>
                </el-col>
                <el-col :span="4">
                  <div class="grid-content bg-purple">
                    
                    <el-select v-model="form.sex" style="width:200px;">
                      <el-option label="男" value="1"></el-option>
                      <el-option label="女" value="0"></el-option>
                      <el-option label="不限" value="2"></el-option>
                    </el-select>
                  </div>
                </el-col>
                 <el-col :span="1">
                  <div class="grid-content bg-purple">
                    地区限制
                    
                  </div>
                </el-col>
                <el-col :span="1">
                  <div class="grid-content bg-purple-light">
                    <el-select v-model="limits" style="width:100px;">
                      <el-option label="不限定" value="0"></el-option>
                      <el-option label="限定" value="1"></el-option>
                    </el-select>
                  </div>
                </el-col>
                <el-col :span="8" v-if="limits==0?yxs=false: yxs=true">
                  <div class="grid-content bg-purple-light">
                    <el-select
                      v-model="province2"
                      placeholder="请选择省"
                      @change="handleChange1(1)"
                      style="padding:0; width:100px;"
                    >
                      <el-option
                        v-for="item in provinces1"
                        :key="item.id"
                        :label="item.label"
                        :value="item.label"
                      ></el-option>
                    </el-select>&nbsp;&nbsp;
                    <el-select
                      v-model="city2"
                      placeholder="请选择市"
                      @change="handleChange2(1)"
                      style="width:100px;"
                    >
                      <el-option
                        v-for="item in citys1"
                        :key="item.id"
                        :label="item.label"
                        :value="item.label"
                      ></el-option>
                    </el-select>&nbsp;&nbsp;
                    <el-select v-model="area2" placeholder="请选择区" style=" width:100px;"
                     @change="handleChange3(area2)"
                    >
                      <el-option
                        v-for="item in areas1"
                        :key="item.id"
                        
                        :label="item.label"
                        :value="item.label"
                      ></el-option>
                    </el-select>
                  </div>
                </el-col>
              </el-row>
              <el-row class="row1">
                <el-col :span="3">
                  <div class="grid-content bg-purple">备注:</div>
                </el-col>
                <el-col :span="7">
                  <div class="grid-content bg-purple">
                    <el-input
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 4}"
                      placeholder="备注"
                      v-model="form.textarea2"
                      style="width:500px;"
                    ></el-input>
                  </div>
                </el-col>
                 
              </el-row>
              <div class="btns" style="margin-left:-300px;">
                <el-button type="primary" @click="dialogVisible1=false ,luckDraw()" style="width:70px;">确 定</el-button>
                <el-button @click="dialogVisible1=false,$router.go(-1)" style="width:70px;margin:0 15px;">取 消</el-button>
              </div>
            </div>

            <div slot="footer" class="dialog-footer">
             
            </div>
          
       
        </div>
      
   
    </div>
  </div>
</template>
<script>
import breadcrumb from '../../components/breadcrumb';
import pagination from '../../components/page';
import { mapActions } from "vuex";
import { areas } from '../../api/getData';
export default {
    components: { breadcrumb,pagination },
      data() {
    return {
       uploadURL:this.upload_(),
        headers: {
        // "Content-Type": "multipart/form-data",
        // "Content-Type": "application/x-www-form-urlencoded",
        // Authorization: window.localStorage.getItem("token")
      },
       goodsims: "",
      //商品的标题
      goodsId: this.$route.query.id || "",
      queryInfo:{
          query:'',
          pagenum:1,
          pagesize:2
      },
       imageUrl2: "",
      isFlag: true,
      active: [],
      bicPig: "",
      imageUrl1: "",
      smallFile: "",
      bigFile: "",
       ids: this.$route.query.ids,
      dialogVisible: false,
      goodsMsg: "", // 商品属性
      provinces1: [],
      citys1: [],
      areas1: [],
      provinces2: [],
      citys2: [],
      areas2: [],
      province1: "",
      province2: "",//请求的省
      provinceId:'',//省的id
      city1: "",
      city2: "",//请求的市
      city2Id:'',//市的id
      area1: "",
      area2: "",//请求的区
      area2Id:'',//区的id
      areauId:'',//区？
      total:0,
      id: "",
      userlist:'',
      value: "",
      value1: "",
      //控制添加信息对话框的显示与隐藏
       form: {
        name: "",
        status: "",
        name1: "",
        name2: "",
        name3: "",
        name4: "",
        sex: "",
        value3: "",
        value4: "",
        textarea2: "",
        Appoint: "", //指定中奖人?
        user:'',//中奖人
        stuser:'',//活动发起方
        max:'',//奖品数量
        iduser:'',//指定中奖人的id
        
      },
     yxs: false,
      limits: "",
       value4: {
        disabledDate: time => {
          // if (this.form.value4) {
          //   return (
          //     time.getTime() > new Date(this.form.value4).getTime()
          //   )
          // } else {
          //   // 不能大于当前日期
          //   return time.getTime() < Date.now()
          // }
        }
      },
      // 结束时间
      value3: {
        disabledDate: time => {
          if (this.form.value3) {
            return (
              time.getTime() > Date.now() ||
              time.getTime() < new Date(this.form.value3).getTime() - 8.64e7 // 加- 8.64e7则表示包当天
            )
          } else {
            return time.getTime() < Date.now()
          }        
      }
      },
     
    
    };
  },
  created() {
      this.getuserList()
      this.handleChange()
        this.goodsId = localStorage.getItem("id") || "";
    localStorage.removeItem("id");
    if (this.goodsId) {
      this.dialogVisible1 = true;
      this.get_goodsDeatil();
    }
    let imgs=''|| []
    if(localStorage.getItem('imgs')){
      let datas=localStorage.getItem('imgs')
       imgs=datas.split(',')
      //console.log(imgs)
      this.form.name=imgs[0]
      this.imageUrl1=imgs[1]
      this.goodsims=imgs[2]
      this.form.value4=imgs[3]
      this.form.status=imgs[4]
      this.form.value3=imgs[5]
      this.form.name4=imgs[6]
      this.goodsId=imgs[7]
      this.form.stuser=imgs[8]
      this.form.max=imgs[9]
      localStorage.removeItem('imgs')
      this.form.user=localStorage.getItem('ids')
      this.form.iduser=localStorage.getItem('iduser')
      localStorage.removeItem('iduser')
      //console.log(this.form.iduser,'iduser')
      this.form.iduser=this.form.iduser.split(',')
      this.form.user=this.form.user.split(',')
      //console.log(this.form.iduser,'iduser')
      //console.log(this.form.user,'名字？')
    
    let f=[]
    for(var i=0;i<this.form.iduser.length;i++){
      var e={}
      for(var j=0;j<this.form.user.length;j++){
       if(i==j){
          e.id=this.form.iduser[i]
        e.name=this.form.user[j]
         f.push(e)
       }
      }
    }
   this.userlist=f
      //console.log(f)
     // //console.log(this.form.user)
    // var obj=this.form.iduser
    //  var obj=this.form.iduser.map((item,index)=>{
    //    return{...item,...this.form.user[index]}
    //  })
      localStorage.removeItem('ids')
      this.getuser()
    }
    // this.InUser()
    // this.luckDraw();
   
  },
  
  methods: {
      ...mapActions(["save_address"]),
    updateDate: function(val) {
      //console.log("val:" + val);
      this.value1 = val;
      //console.log("this.value1:" + this.value1);
    },
    //处理图片预览效果
    handlePreview() {},
    //处理移除图片的操作
    handleRemove(file) {
      //console.log(file);
      // this.imageUrl1 = "";
    },
    //监听图片上传成功的事件
    handleSuccess(response, file, fileList) {
      //console.log(response, "1");
      //这个是奖品图片地址
      // //console.log(file.url);
      // //console.log(fileList,'fileList')
      this.imageUrl1 = response;
    },
     handleChange5(file) {
      // //console.log(file,'成功？')
    },
      //请求省市地区
    handleChange(father = -1, level = 1) {
      // let data="father="+father+'&level='+level
      this.$axios
        .post("web_dict_address/get", "father=" + father + "&level=" + level)
        .then(result => {
          if (result.data.status == 0) {
            result.data.data.forEach(item => {
              this.provinces1.push({
                label: item.name,
                id: item.id
              });
              this.provinces2.push({
                label: item.name,
                id: item.id
              });
            });
          }
        });
    },
    get_city_area(type) {
      let id = "";
      let city = "";
      if (type == 1) {
        let province = this.province1;
        city = this.city1;
        this.provinces1.forEach(item => {
          if (item.label == province) {
            id = item.id;
          }
        });
      } else {
        let province = this.province2;
        city = this.city2;

        this.provinces2.forEach(item => {
          if (item.label == province) {
            id = item.id;
          }
        });
      }

      this.$axios
        .post("web_dict_address/get", "father=" + id + "&level=" + 2)
        .then(result => {
          if (result.data.status == 0) {
            result.data.data.forEach(item1 => {
              if (type == 2) {
                this.citys1.push({ label: item1.name, id: item1.id });
              } else {
                this.citys2.push({ label: item1.name, id: item1.id });
              }
              if (item1.name == city) {
                let id = item1.id;
                this.$axios
                  .post("web_dict_address/get", "father=" + id + "&level=" + 3)
                  .then(result => {
                    if (result.data.status == 0) {
                      result.data.data.forEach(item2 => {
                        if (type == 2) {
                          this.areas1.push({
                            label: item2.name,
                            id: item2.id
                          });
                        } else {
                          this.areas2.push({
                            label: item2.name,
                            id: item2.id
                          });
                        }
                      });
                    }
                  });
              }
            });
          }
        });
    },
    handleChange1(type) {
      // type 用来判断是收货信息中的地址， 还是售后中的地址'
      let id = "";
      if (type == 1) {
        this.city2 = "";
        this.area2 = "";
        this.citys1 = [];
        this.areas1 = [];

        this.provinces1.forEach(item => {
          if (item.label == this.province2) {
            id = item.id;
          }
        });
      } else {
        this.city1 = "";
        this.area1 = "";
        this.citys2 = [];
        this.areas2 = [];
        this.provinces2.forEach(item => {
          if (item.label == this.province1) {
            id = item.id;
          }
        });
      }

      this.$axios
        .post("web_dict_address/get", "father=" + id + "&level=" + 2)
        .then(result => {
          if (result.data.status == 0) {
            result.data.data.forEach(item => {
            //  //console.log(result.data.data,'这个是什么')
              if (type == 1) {
                this.provinceId=result.data.data[0].id-1
               //console.log(item.id)
               //console.log(result.data.data,'22')
              //  //console.log(Number(result.data.data[0].id)+Number(1),'市区？')
              // this.city2Id=Number(result.data.data[0].id)+Number(1)
              result.data.data.forEach(item=>{
              //   if(item.id=this.city2Id){
              //     this.city2Id=item.id
              //  //console.log(this.city2Id,'市？')
            //    }
              })
              // if(this.city2Id!==item.id){
              //    this.city2Id=item.id
              //    //console.log(this.city2Id,'市？')
              // }
              
              // if(this.provinceId==item.id){
              //   this.city2Id=item.id
              //    //console.log(this.city2Id,'市？')
              // }
                this.citys1.push({ label: item.name, id: item.id });
              } else {
                 //console.log(result.data.data,'2')
                this.citys2.push({ label: item.name, id: item.id });
              }
            });
          }
        });
    },
    //请求市区
    handleChange2(type) {
     // //console.log(this.city2,'区吗')
      let id = "";
      if (type == 1) {
        this.areas1 = [];
        this.area2 = "";
        this.citys1.forEach(item => {
          //console.log(this.citys1,'这个是区吗')
          if (item.label == this.city2) {
            //console.log(item.id,'222222')
            this.city2Id=item.id
            id = item.id;
          }
        });
      } else {
        this.areas2 = [];
        this.area1 = "";
        this.citys2.forEach(item => {
          //console.log(this.citys2)
          if (item.label == this.city1) {
            id = item.id;
          }
        });
      }
      this.$axios
        .post("web_dict_address/get", "father=" + id + "&level=" + 3)
        .then(result => {
          if (result.data.status == 0) {
            result.data.data.forEach(item => {
              if (type == 1) {
                //this.city2=result
               // //console.log(result.data.data,'区')
               this.areauId=result.data.data
                this.areas1.push({ label: item.name, id: item.id });
              } else {
                this.areas2.push({ label: item.name, id: item.id });
              }
            });
            // result.data.data.forEach(item=>{
            //   if(item.id=result.data.data.id){
            //     //console.log(result)
            //   }
            // })
          }
        });
    }, 
    handleChange3(area2){
      //console.log(this.areauId)
      this.areauId.forEach(item=>{
        ////console.log(this.areauId,'名字？')
       if(item.name==area2){
          // //console.log(this.areauId[0])
          //console.log(item,'22')
        this.area2Id=item.id
        //console.log(this.area2Id)
       }
      })
    },
      getuserList(){
          this.goodsTypeList
          this.total=11
          //console.log(11)
      },
      //监听pagesize改变的函数事件
      handleSizeChange(newSize){
          //console.log(newSize)
          this.queryInfo.pagesize=newSize
          this.getuserList()
      },
      handleCurrentChange(newPage){
          //console.log(newPage)
          this.queryInfo.pagenum=newPage
      },
       handleChange(father = -1, level = 1) {
      this.$axios
        .post("web_dict_address/get", "father=" + father + "&level=" + level)
        .then(result => {
          if (result.data.status == 0) {
            result.data.data.forEach(item => {
              this.provinces1.push({
                label: item.name,
                id: item.id
              });
              this.provinces2.push({
                label: item.name,
                id: item.id
              });
            });
          }
        });
    },
  
    //  handleRemove1() {
    //   this.imageUrl2 = "";
    // },
    async get_goodsDeatil(){
      const {data:res}=await this.$axios.post('/web_goods/get_one','id='+this.goodsId)
      this.goodsims=res.data.goods.name
      this.imageUrl1=res.data.goods.pictureUrl
    },
    getlist(){
     
      let imgs=[]
      imgs.push(this.form.name,this.imageUrl1,this.goodsims,this.form.value4,this.form.status
      ,this.form.value3,this.form.name4,this.goodsId,this.form.stuser,this.form.max
      )
       localStorage.setItem('imgs',imgs)
       // localStorage.setItem('imageUrl1',JSON.stringify(this.imageUrl1))
     this.$router.push('/goodsusers')
    },
    getuser(){
      this.$axios.post('web_user/list','id='+this.ids).then(res=>{
        //console.log(res)
      })
    },
    luckDraw(){
      //console.log(this.goodsId)
      //console.log(this.form.iduser,'22')
     if(this.form.iduser){
        var winId=this.form.iduser.join(',')
     }
      //console.log(winId)
      var obj={
        goods:{
           bannerUrl: this.imageUrl2,
          pricture: this.imageUrl1,
         // name: this.goodsims,
         name:this.form.name,
          goodsId: this.goodsId,
          number:this.form.max
        },
        luckySet:{
            maxPeopleNum: this.form.name4,
          minPeopleNum: this.form.name3,
          startTime: this.form.value4,
          type: this.form.status,
          note: this.form.textarea2,
          endTime: this.form.value3,
          gender: this.form.sex,
          limits: this.limits,
          winId:winId,
          startName:this.form.stuser,
          //  province: this.provinceId,
          // region: this.city2Id,
          // town: this.area2Id,
           province: this.limits==0?'1707':this.provinceId,
          region: this.limits==0?'1708':this.city2Id,
          town: this.limits==0?'1715':this.area2Id,
        }
      }
      // //console.log(this.provinces1.id)
     // //console.log(obj)
      //console.log(this.form.value4,this.form.value3)
      if(!this.form.Appoint){
          return this.$message({
                    type: "warning",
                    message: "请选择是否指定中奖人"
                  });
      }
      if(this.startName){
        return this.$message({
          type:'warning',
          message:'请输入活动发起方'
        })
      }
      //if(this.)
      //let idlist=this.iduser.lenght
      let idlist=Number(this.form.max||0)
    //console.log(idlist,this.form.iduser[idlist])
      if(this.form.iduser[idlist]){
        return this.$message({
          type:'warning',
          message:'奖品数量不能小于指定中奖用户'
        })
      }
      if(!this.form.max){
        return this.$message({
          type:'warning',
          message:'奖品数量不能为空'
        })
      }
      if(!this.form.value4){
        return this.$message({
          type:'warning',
          message:'请选择活动开始时间'
        })
      }
      if(!this.form.value3){
        return this.$message({
          type:'warning',
          message:'请选择活动结束时间'
        })
      }
      if(!this.form.status){
        return this.$message({
          type:'warning',
          message:'请选择开奖方式'
        })
      }
      if(!this.form.sex){
        return this.$message({
          type:'warning',
          message:'请指定性别'
        })
      }
      if(!this.limits){
        return this.$message({
          type:'warning',
          message:'请选择是否指定地区限制'
        })
      }
      this.$axios.post('web_free_lucky/add_set',obj).then(res=>{
        if(res.data.status!==200){
          if(res.data.status==0){
            this.$router.push('/freeLotteryAdd')
            return this.$message({
              type:'success',
              message:'操作成功'
            })
          }else{
            return this.$message({
              type:'warning',
              message:'添加数据失败'
            })
          }
        }
      })
    },
    //根据id删除对应的用户
    getr(id){
    //  this.userlist.remove(id)
    //  this.form.iduser.remove(id)
    //console.log(this.userlist,'这个是中奖人数据')
    const i=this.userlist.findIndex(x=>x.id===id)
    if(i!==-1){
      this.userlist.splice(i,1)
      this.form.iduser.splice(i,1)
    }
  
    }
  },
}
</script>
<style lang="less" scoped>
.goods_mana_type-container {
  @import "../../style/table.less";
  @import "../../style/content.less";
  display: flex;
  flex-flow: column;
  position: relative;
  height: 100%;
  .el-table .cell {
    white-space: pre-line !important;
  }
  
  .content {
    .query {
      .btn {
        position: absolute;
        top: 10%;
        .el-button {
          width: 70px;
        }
      }
    }
  }
 
}
// .query_big_pic{
//     // display: flex;
//     // // flex-direction:row ;
//     // //       flex-wrap:wrap;
//     // //       justify-content:space-around;
//     //       flex: 1;
//     // text-align: left;
// }
.avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 150px;
    height: 150px;
    line-height: 150px;
    text-align: center;
    border: 1px solid #ccc;
  }
.avatar {
    width: 150px;
    height: 150px;
    display: block;
  }
 .lunbo_pic {
              width: 150px;
              height: 120px;
              .el-icon-plus.avatar-uploader-icon {
                width: 150px;
                height: 120px;
                line-height: 120px;
              }
              img {
                width: 150px;
                height: 120px;
              }
            }
            .box {
  // background-color: #eee;
  margin: 15px 0;
}
.box > .row {
  font-size: 22px;
  font-weight: 700;
}
.box > .row1 {
  margin: 20px 0;
  font-size: 14px;
  font-weight: 400;
}
.box > .row1 .el-input__inner {
  // width: 40px;
  height: 30px;
}
.box > .row span {
  display: inline-block;
  // color: red;
}
.el-row {
  // margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  // margin: 0 10px;
  min-width: 110px;
  border-radius: 4px;
}


.grid-content {
  border-radius: 4px;
  min-height: 36px;
  line-height: 36px;
  min-width: 40px;
}

.row-bg {
  // padding: 10px 0;
  background-color: #f9fafc;
}
.btns{
  position: absolute;
  bottom: 10%;
  left: 50%;
}
</style>